__author__="keiouu"
__date__ ="$12-Jan-2011 00:28:15$"

from plugin import _plugin

# Helper functions
from functools import wraps
def thread(func):
	from threading import Thread
	@wraps(func)
	def nfunc(*args, **kwargs):
		t = Thread(target = func, args = args, kwargs = kwargs)
		t.start()
		return t
	return nfunc

def process(func):
	from multiprocessing import Process
	@wraps(func)
	def nfunc(*args, **kwargs):
		t = Process(target = func, args = args, kwargs = kwargs)
		t.start()
		return t
	return nfunc

def irc_throw(func):
    @wraps(func)
    def nfunc(*args, **kwargs):
        res = func(*args, **kwargs)
        if res and isinstance(res, basestring):
            _plugin.irc.reply(args[1], res)
        return res
    return nfunc

def ignore_throw(func):
	import traceback, sys
	@wraps(func)
	def nfunc(*args, **kwargs):
		try: func(*args, **kwargs)
		except: traceback.print_exc(file=sys.stderr)
	return nfunc

import core
reload(core)
from core import _core as Core

import database
reload(database)
from database import database

import admin
reload(admin)
from admin import admin

import hi
reload(hi)
from hi import hi

import stats
reload(stats)
from stats import stats

import mailbox
reload(mailbox)
from mailbox import mailbox

import remind
reload(remind)
from remind import remind

import rng
reload(rng)
from rng import rng

import shopping
reload(shopping)
from shopping import shopping

import todo
reload(todo)
from todo import todo
